package com.fdb;

public class Calculator {
    private int number1;
    private int number2;
    private int operator;

    public int getNumber1() {
        return number1;
    }

    public int getNumber2() {
        return number2;
    }

    public String getOperator() {
        if(operator==1){
            return "+";
        }
        else if(operator==2){
            return "-";
        }
        else if(operator==3){
            return "*";
        }
        else {
            return "/";
        }
    }

    public void setNumber1(int number1) {
        this.number1 = number1;
    }



    public void setNumber2(int number2) {
        this.number2 = number2;
    }



    public void setNumber1(String operator) {

        if (operator.equals("+")){this.operator=1;}
        else if(operator.equals("-")){this.operator=2;}
        else if(operator.equals("*")){this.operator=3;}
        else if(operator.equals("/")){this.operator=4;}

    }

    public int Cal(){
            int ret=0;
            System.out.println(this.operator);
            System.out.println(this.number1);
            switch (this.operator){
                case 1: ret=this.number1+this.number2;
                    break;
                case 2: ret=this.number1-this.number2;
                    break;
                case 3: ret=this.number1*this.number2;
                    break;
                case 4: ret=this.number1/this.number2;
                    break;
            }
            return ret;
    }
}
